package huashu.net.complain.until;

import java.text.NumberFormat;

public class Until {
    public static String CODE ="200";
    public static String MSG="successful";

    //小数转成百分比 比如0.8888888888 return 88.89%
    public static String returnPercent(String str)
    {

        if(str!=null&&!"".equals(str)){
            Double  num = Double.parseDouble(str);
            NumberFormat nf = NumberFormat.getPercentInstance();
            nf.setMaximumFractionDigits(2);//最大小数位数
            nf.setMaximumIntegerDigits(3);//最大整数位
            nf.setMinimumFractionDigits(2);//最小小数位
            nf.setMinimumIntegerDigits(1);//最小整数位
            String  percent  = nf.format(num);
            percent = percent.replace("%","");
            return percent;
        }
        return "0";
    }

}
